/*
 * Created: 2022-08-25 20:00:45
 * Author : 涛涛涛
 */

import React, { FC, useContext } from 'react';
import { View, Text } from '@tarojs/components';
import { styled } from 'linaria/react';
import { useClassName } from '@/utils/index';
import { ProductItemContext } from '@/pages/Home/ProductList/ProductItem/ProductItemContext';
import { useDownTime } from './useDownTime';
export interface IProps extends ICompProps {}
WillLaunch.defaultProps = {} as Partial<IProps>;
function WillLaunch(props: IProps) {
    const { className, style } = props;
    const localClassName = useClassName('WillLaunch', className);
    const product = useContext(ProductItemContext);
    const { downTime } = useDownTime(product.dropStartDate);
    return (
        <RootView className={localClassName} style={style}>
            <Text>即将发行</Text>
            <Text className="downTime">{downTime}</Text>
        </RootView>
    );
}
export default React.memo(WillLaunch as FC<IProps>);
const RootView = styled(View)`
    &.WillLaunch {
        padding: 20px 30px;
        border-radius: 8px;
        background-color: rgba(0, 0, 0, 0.6);
        font-size: 24px;
        line-height: 1;
        color: #fff;
        .downTime {
            margin-left: 10px;
            color: #fe8828;
            font-weight: 600;
        }
    }
`;
